<template>
  <div class="MonetaryAnalysis">
    <el-card>
      <div class="head">
        <h3>钻石充值</h3>
        <div class="rhght">
          <el-date-picker
            size="small"
            v-model="timeArr"
            type="daterange"
            align="right"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :picker-options="timeOptions"
            value-format="yyyy-MM-dd"
            @change="focus"
          >
          </el-date-picker>
          <el-button class="btn" icon="el-icon-search" size="small"
            >查询搜索</el-button
          >
          <el-button icon="el-icon-paperclip" size="small">导出EXCEL</el-button>
        </div>
      </div>
      <el-radio-group v-model="value" size="small" fill="#7b94d8">
        <el-radio-button label="1">充值档位2</el-radio-button>
        <el-radio-button label="2">充值档位4</el-radio-button>
        <el-radio-button label="24">充值档位6</el-radio-button>
      </el-radio-group>
      <el-table
        :data="tableData"
        style="width: 100%; margin-top: 10px"
        :header-cell-style="{ background: '#f5f7fa' }"
      >
        <template slot="empty">
          <el-empty :image-size="200"></el-empty>
        </template>
        <el-table-column prop="date" label="钻石数"> </el-table-column>
        <el-table-column prop="date" label="人数"> </el-table-column>
        <el-table-column prop="date" label="充值时间"> </el-table-column>
      </el-table>
      <pagination
        :total="total"
        :page.sync="page"
        :limit.sync="pageSize"
        @pagination="getList"
      />
    </el-card>
    <!-- 钻石消耗 -->
    <el-card style="margin-top: 20px">
      <div class="head">
        <h3>钻石消耗</h3>
        <div class="rhght">
          <el-date-picker
            size="small"
            v-model="timeArr1"
            type="daterange"
            align="right"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :picker-options="timeOptions"
            value-format="yyyy-MM-dd"
            @change="focus1"
          >
          </el-date-picker>
          <el-button class="btn" icon="el-icon-search" size="small"
            >查询搜索</el-button
          >
          <el-button icon="el-icon-paperclip" size="small">导出EXCEL</el-button>
        </div>
      </div>
      <el-radio-group v-model="type" size="small" fill="#7b94d8">
        <el-radio-button label="1">公告礼物</el-radio-button>
        <el-radio-button label="2">普通礼物</el-radio-button>
        <el-radio-button label="24">连击礼物</el-radio-button>
      </el-radio-group>
      <el-table
        :data="tableData1"
        style="width: 100%; margin-top: 10px"
        :header-cell-style="{ background: '#f5f7fa' }"
      >
        <template slot="empty">
          <el-empty :image-size="200"></el-empty>
        </template>
        <el-table-column prop="date" label="钻石数"> </el-table-column>
        <el-table-column prop="date" label="人数"> </el-table-column>
        <el-table-column prop="date" label="充值时间"> </el-table-column>
      </el-table>
      <pagination
        :total="total1"
        :page.sync="page1"
        :limit.sync="pageSize1"
        @pagination="getList1"
      />
    </el-card>
  </div>
</template>

<script>
import Pagination from "@/components/Pagination"; // 分页
export default {
  components: { Pagination },
  data() {
    return {
      //金币充值
      timeArr: [],
      startTime: "",
      endTime: "",
      value: "",
      tableData: [],
      total: 0,
      page: 1,
      pageSize: 10,
      timeArr1: [],
      startTime1: "",
      endTime1: "",
      type: "",
      tableData1: [],
      total1: 0,
      page1: 1,
      pageSize1: 10,
      //通用
      timeOptions: {
        disabledDate(platformValue) {
          return platformValue.getTime() > Date.now() - 8.64e6;
        },
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 6);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            },
          },
        ],
      },
    };
  },
  methods: {
    focus() {
      if (!this.timeArr) {
        this.timeArr = [];
      }
      this.startTime = this.timeArr[0];
      this.endTime = this.timeArr[1];
    },
    focus() {
      if (!this.timeArr1) {
        this.timeArr1 = [];
      }
      this.startTime1 = this.timeArr1[0];
      this.endTime1 = this.timeArr1[1];
    },
    getList() {},
    getList1() {},
  },
  mounted() {},
};
</script>

<style lang="less" scoped>
.MonetaryAnalysis {
  padding: 20px;
  .el-card {
    margin-bottom: 20px;
  }
  .head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    h3 {
      margin: 0;
    }
  }
  h4 {
    margin-top: 0;
  }
}
</style>